import request from '@/utils/request'

// 查询内容模块列表
export function listContentCategory(query) {
  return request({
    url: '/system/contentCategory/list',
    method: 'get',
    params: query
  })
}

// 查询内容模块详细
export function getContentCategory(id) {
  return request({
    url: '/system/contentCategory/' + id,
    method: 'get'
  })
}

// 新增内容模块
export function addContentCategory(data) {
  return request({
    url: '/system/contentCategory',
    method: 'post',
    data: data
  })
}

// 修改内容模块
export function updateContentCategory(data) {
  return request({
    url: '/system/contentCategory',
    method: 'put',
    data: data
  })
}

// 删除内容模块
export function delContentCategory(id) {
  return request({
    url: '/system/contentCategory/' + id,
    method: 'delete'
  })
}

export function listContentsByCategory(categoryId) {
  return request({
    url: '/system/contentCategory/listByCategory/'+categoryId,
    method: 'get'
  })
}

export function addToCategory(ids, categoryId) {
  var data = {
    ids: ids,
    categoryId: categoryId
  }
  return request({
    url: '/system/contentCategory/addToCategory',
    method: 'post',
    data: data
  })
}

export function removeFromCategory(id) {
  return request({
    url: '/system/contentCategory/removeFromCategory/'+ id,
    method: 'delete'
  })
}


export function updateToCategory(data) {
  return request({
    url: '/backstage/sys/update/content',
    method: 'post',
    data: data
  })
}
